<style lang="less">
    @import "${aggregate.name}_detail.less";
</style>
<template>
	<div>
		<Row>
			<i-col span="12">
				<div class="es-list-content">
					<Form ref="pageForm" :model="page.form">
                        <Row style="padding-top:20px">
<#list aggregate.fields as field>
<#if field.required == true>
<#if field.name=='status'>
                            <FormItem :label-width="190" label="状态：" prop="status">
                                <i-switch size="large" :true-value="1" :false-value="0" v-model="page.form.status" disabled>
                                    <span :slot="1">启用</span>
                                    <span :slot="0">禁用</span>
                                </i-switch>
                            </FormItem>
<#elseif field.name?contains('type')>
							<FormItem :label-width="190" label="${field.desc}:" prop="${field.camelName}">
								<Select placeholder="请选择${field.desc}" v-model="page.form.${field.camelName}" disabled>
									<Option :value="1" :key="1">类型1</Option>
									<Option :value="2" :key="2">类型2</Option>
									<Option :value="3" :key="3">类型3</Option>
								</Select>
							</FormItem>
<#else>
                            <FormItem :label-width="190" label="${field.desc}：" prop="${field.camelName}">
                                <Input autocomplete="off" placeholder="请填写${field.desc}"  v-model="page.form.${field.camelName}" disabled/>
                            </FormItem>
</#if>
</#if>
</#list>
                        </Row>
                        <Row>
							<Form>
								<FormItem :label-width="190" label="" prop="">
									<Button type="primary" @click="cancel${aggregate.largeCamelName}DetailPage" :loading="page.loading" style="margin-right:20px;">返 回</Button>
								</FormItem>
							</Form>
                        </Row>
					</form>
				</div>
			</i-col>
		</Row>
	</div>
</template>

<script>
import {
    remote${aggregate.largeCamelName}Query,
} from '@/api/clean/admin/${domain.system}'
export default {
	props: {
		id: null,
	},
    data() {
        return {
            page: {
                loading: false,
                form: {
<#list aggregate.fields as field>
                    ${field.camelName}: '',
</#list>
                },
            },
        };
    },
	mounted() {
		this.init${aggregate.largeCamelName}Info()
	},
    methods: {
        init${aggregate.largeCamelName}Info: function(){
            remote${aggregate.largeCamelName}Query({id:this.id}).then(res=>{
                if (res.code != 10000) {
                    this.$Message.error(res.msg)
                    return
                }
                this.page.form = {
                    id: res.data.id,
<#list aggregate.fields as field>
<#if field.required?? && field.required==true>
					${field.camelName}: res.data.${field.camelName},
</#if>						
</#list>  
                }
            })
        },
        // 关闭添加页
        cancel${aggregate.largeCamelName}DetailPage: function() {
            this.$emit("parentTabClose", 'detail');
        },
    }
}
</script>